<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserFollows extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_follows', function (Blueprint $table) {
            $table->comment = '用户行为跟踪表';
            $table->increments('id')->comment('主键');
            $table->unsignedInteger('user_id')->default(0)->nullable()->comment('用户id')->index();
            $table->string('channel', 50)->nullable()->default('')->comment('渠道')->index();
            $table->unsignedInteger('type')->nullable()->comment('节点')->index();
            $table->string('type_desc')->default('')->comment('节点描述');
            $table->unsignedInteger('code')->default('0')->comment('请求结果状态');
            $table->string('response')->default('')->comment('响应信息');
            $table->string('ip', 30)->nullable()->comment('ip');
            $table->string('mac_address', 100)->nullable()->comment('mac地址');
            $table->unsignedInteger('device')->nullable()->comment('设备型号');
            $table->char('version', 4)->nullable()->comment('版本');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_follows');
    }
}
